package org.sky.sys.service;

import org.sky.sys.dao.SysOrganMapper;
import org.sky.sys.entity.SysOrgan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class SysOrganService {
    @Autowired
    private SysOrganMapper sysOrganMapper;

    public SysOrgan get(String code) throws RuntimeException {
        SysOrgan so = sysOrganMapper.getByCode(code);
        if(null==so){
            throw new RuntimeException("该Code"+code+"找不到对应组织机构");
        }else{
            return so;
        }
    }
    public void insertSysOrgan(SysOrgan sysOrgan){
        sysOrganMapper.insert(sysOrgan);
    }
    public List selectByFilter(Map filter){
        return sysOrganMapper.selectByFilter(filter);
    }
}
